NW 09 - Determining if a Drive is a Network Volume
Title Banner


Technical Q&A's


NW 09 - Determining if a Drive is a Network Volume (1-June-95)


Q If I have the physical drive ID for a drive, how can I dependably determine if the drive is a network volume?

A On the current Macintosh file system, there is no completely dependable way to determine if a volume is accessed over a network or is implemented as a local disk because of the way in which external file systems are implemented (third parties can build network file systems in a variety of ways).

You can, however, easily determine if a volume utilizes the AFP (AppleShare) file system, and this is adequate in most cases. To do this, compare the drive-queue entry's driver refnum to the AppleShare client's.

The following code sample enumerates the drive queue and displays the relevant information.

main()
{
  	QHdrPtr		DrvQHdr =  GetDrvQHdr();
	DrvQElPtr	dqeP;
	short		afpRefNum = 0;
	OSErr		ErrNo;

// Get the Driver refNum for AFP 
	ErrNo	= OpenDriver("\p.AFPTranslator",&afpRefNum);

// Scan each drive in the Drive Table
	dqeP = (DrvQElPtr)DrvQHdr->qHead;
	do {

// is it an AFP volume or SCSI device		   
		if(dqeP->dQRefNum == afpRefNum) printf("AFP  ");

	} while (dqeP =(DrvQElPtr) dqeP->qLink);
}

For third-party file systems, such as DECNET and NFS, you can use the same procedure if you can determine the name of the driver.

Technical Support
Technical Q&As
Previous Question | Contents | Next Question

Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help